<template>
	<s-layout
		title="个人中心"
		tabbar="/pages/index/user"
		navbar="custom"
		:bgStyle="bgStyle"
		:navbarStyle="navigation"
		onShareAppMessage
		:showFloatButton="true"
	>
		<s-block v-for="(item, index) in template" :key="index" :styles="item.setStyle.dataStyle">
			<s-block-item
				:type="item.type"
				:data="item.setStyle"
				:styles="item.setStyle.dataStyle"
			/>
		</s-block>
	</s-layout>
</template>

<script setup>
	import { computed } from 'vue';
	import { onShow, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
	import app from '/shop/store/app.js';
	import user from '/shop/store/user.js';
	// 隐藏原生tabBar
	// uni.hideTabBar();
  // 隐藏原生tabBar
  uni.hideTabBar({
    fail: () => {},
  });
	const template = computed(() => {
		console.log('app().template?.user: ', app().template?.user);
		return app().template?.user;
	});

	const setup = computed(() => {
		return app().template?.setup;
	});

	const navigation = computed(() => {
		const navigation =  app().template?.user.find(e=>e.type === 'pageSetting').setStyle
		return navigation
		
		// return app().template.navigation;
	});

	const bgStyle = computed(()=> {
		
		const bgStyle =  app().template?.user.find(e=>e.type === 'pageSetting').setStyle.background
		return bgStyle
		
		
	})
	const isLogin = computed(() => user().isLogin);

	onShow(() => {
		user().updateUserData();
	});

	onPullDownRefresh(() => {
		user().updateUserData();
		setTimeout(function () {
			uni.stopPullDownRefresh();
		}, 800);
	});

	onPageScroll(() => {});
</script>

<style></style>
